All Questions
10 questions
4votes
7answers
279views
Breaking a string expression in operator and operands
Requesting for a code review for a scala implementation. Problem Given an expression string made of numbers and operators +,-,/,* , break it in a list of Integer or ...
1vote
2answers
81views
Extracting items from comma/semicolon-delimited strings, discarding parts after a hyphen
New Scala dev here. Is there a more idiomatic or efficient way to accomplish this in Scala? Given a list of the following strings, I need to obtain the unique 'main parts' once any parts including ...
3votes
3answers
1kviews
Shell script to parse variable definitions from Scala build file
The build.sbt text file contains versions like this: name := "happy" scalaVersion := "2.11.8" sparkVersion := "2.2.0" I wrote ...
1vote
2answers
179views
Record parsing to Scala object with some unknown fields
I am getting some customer data but don't know the complete schema beforehand. I want to parse this data and create a Scala object from it. But due to unknown fields in the record, I fill only the ...
1vote
1answer
150views
Parsing latitude and longitude, using Try[T] to ignore errors
I wrote this question asking about how to implement my error handling while still maintaining functional code and based on 200_success's very interesting note on the spaces, I decided to ...
2votes
2answers
711views
Convert a String with comma separated latitudes and longitudes to a Seq[Coordinate]
I have a function that receives a String like the following: "-10.0 -10.0,10.0 10.0,0.0 0.0" And needs to translate that into ...
4votes
1answer
271views
Solution to part 1 of Day 7 Advent of Code in Scala
Does someone want to review my solution to part 1 of Day 7 Advent of Code in Scala? The assignment is here: http://adventofcode.com/day/7 Without repeating the whole text, in short: Given a text file ...
6votes
2answers
134views
Text tokenizer example
Here is a partial example of a text tokenizer. I'm looking for ways to improve one particular line in this code: ...
5votes
2answers
3kviews
Reading and parsing CSV files
This is my first real attempt at a Scala program. I come from a predominantly Java background, so I'd like to know if the program sticks to Scala conventions well. Is it well readable or should it ...
7votes
2answers
7kviews
Handling parsing failure in Scala without exceptions
I have a Scala (Play!) application that must get and parse some data in JSON from an external service. I want to be able to gently handle failure in the response format, but it is becoming messy. What ...